<script setup lang='ts'>
 import father from './components/16-跨代传值的父亲组件.vue'
 import { ref ,provide } from 'vue'
 const salary=ref(10000)
 
 //谁提供的数据，谁负责修改
 provide('money',salary)//提供给后代使用
provide('cost',(costMoney:number)=>{
  salary.value-=costMoney
})
</script>
       
<template>
 <h1>我是爷爷</h1>
 <p>爷爷的退休金：{{ salary }}</p>
 <father/>      
</template>
       
<style scoped>
       
</style>